<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <meta name="author" content="纪德朝">
    <title>jquery下拉列表练习</title>
    <style>
        * {
            box-sizing: border-box;
        }

        div {
            width: 300px;
            /* height: 200px; */
            margin: 0 auto;
            border: 1px solid black;
            text-align: center;
            display: flex;
        }

        ul {
            margin: 0;
            padding: 0;
            list-style: none;
            /* width: 100px; */
        }

        .first {
            display: flex;
        }

        li.current {
            margin: 0;
            padding: 0;
            width: 100px;
            height: 40px;
            line-height: 40px;
            background-color: black;
            color: white;
        }

        li.active {

            display: none;
        }
    </style>
</head>

<body>
    <div>
        <ul class="one">
            <ul class="first">
                <li class="current">选项卡1</li>
                <li class="current">选项卡2</li>
                <li class="current">选项卡3</li>
            </ul>
            <li class="active">
                <p>第一项</p>
                <p>第一项</p>
            </li>
            <li class="active">
                <p>第二项</p>
                <p>第二项</p>
                <p>第二项</p>
            </li>
            <li class="active">
                <p>第三项</p>
                <p>第三项</p>
                <p>第三项</p>
                <p>第三项</p>
            </li>
        </ul>
    </div>
    <script src="./js/jquery.js"></script>
</body>
<script>
    var index = 0;
    $('.active').eq(0).css('display','block');
    $('.current').each(function (index) {
        console.log(index);
        $(this).mouseover(function () {
            $('.current').eq(index).css('background', 'gray');
            console.log(index);
            $('.active').css('display','none');
            $('.active').eq(index).css('display', 'block');

        })
        $(this).mouseout(function () {
            $('.current').eq(index).css('background', 'black');

        })
    })

</script>

</html>